'use strict';

const queryProductList = require('../actions/product/getProductAllAction');
module.exports = async function (ctx) {
    let param = ctx.method === 'GET' ? ctx.query : ctx.request.fields;
    let action_type = param.action_type;
    try {
        switch (action_type) {
            case 'queryProductList':
                let result = await queryProductList(param);
                await ctx.render('index', {
                    data: result.data
                })
                break;
        }
    } catch (e) {
        ctx.body = {success: false, message: e.message};
    }

};